#include <stdio.h>
#include <stdlib.h>
#include <time.h>
typedef int ElemType;
typedef struct
{
    ElemType *elem;
    int lenth;
}SSTable;
void InitSS(SSTable &ST,int len)
{
    ST.lenth=len;
    ST.elem=(ElemType *) malloc(sizeof(ElemType)*ST.lenth);
    srand(time(NULL));
    int i=0;
    while(i<ST.lenth)
    {
        ST.elem[i]=rand()%100;
        i++;
    }
}
void printSStable(SSTable ST)
{
    for(int i=0;i<ST.lenth;i++)
    {
        printf("%3d",ST.elem[i]);
    }
    printf("\n");
}
void Insert_sort(ElemType *A,int len)
{
    int i,j,insertVal;
    for(i=1;i<len;i++)
    {
        insertVal=A[i];
        for (j = i-1;j>=0&&A[j]>insertVal; j--) {
            A[j+1]=A[j];
        }
        A[j+1]=insertVal;
    }
}
int main()
{
    SSTable ST;
    InitSS(ST,10);
    printSStable(ST);
    Insert_sort(ST.elem,10);
    printSStable(ST);
    return 0;
}